import requests
from requests.auth import HTTPProxyAuth

url = 'http://httpbin.org/ip'

headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',

}

resp = requests.get(url,headers=headers)
print('before:',resp.json())

# 使用代理的写法

proxy_auth = HTTPProxyAuth('d2049164873', '3z7275jh')
proxies = {
    'http':'http://112.29.133.160:40341',
}


resp = requests.get(url,headers=headers,proxies=proxies,auth=proxy_auth)
print(resp.status_code)

print('after:',resp.text)

